import http from "@/api/http";

const BASE_URL_PATH = "/quickLink";
const GROUP_BASE_URL_PATH = "/quickLinkGroup";

export default {
  list() {
    return http.get(`${BASE_URL_PATH}/list`);
  },
  get(id) {
    return http.get(`${BASE_URL_PATH}/${id}`);
  },
  listGroupsWithLinks() {
    return http.get(`${BASE_URL_PATH}/listGroupsWithLinks`);
  },
  add(data) {
    return http.post(`${BASE_URL_PATH}`, { data: JSON.stringify(data) });
  },
  update(data) {
    return http.put(`${BASE_URL_PATH}`, { data: JSON.stringify(data) });
  },
  delete(id) {
    return http.delete(`${BASE_URL_PATH}/${id}`);
  },
  deleteGroupWithLinks(groupId) {
    return http.delete(`${BASE_URL_PATH}/deleteGroupWithLinks`, {
      params: { groupId },
    });
  },
  listGroup() {
    return http.get(`${GROUP_BASE_URL_PATH}/list`);
  },
  addGroup(data) {
    return http.post(`${GROUP_BASE_URL_PATH}`, { data: JSON.stringify(data) });
  },
  updateGroup(data) {
    return http.put(`${GROUP_BASE_URL_PATH}`, { data: JSON.stringify(data) });
  },
  deleteGroup(id) {
    return http.delete(`${GROUP_BASE_URL_PATH}/${id}`);
  },
};
